/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package filesTableModel;

import SessionBeans.web.beans.FolderInfo;
import SessionBeans.web.beans.FolderTypeEnum;
import entities.Folder;
import entities.Rights;
import java.util.List;

/**
 *
 * @author Tomas
 */
public class TableItemFolder2 extends TableItemAbstract<Folder>{

    protected FolderInfo folderInfo;

    public TableItemFolder2(FolderInfo folderInfo) {
        this.folderInfo = folderInfo;
        this.type = TableItemTypeEnum.FOLDER;
    }

    public TableItemFolder2(FolderInfo folderInfo, List<TableItemInterface> childs) {
        this(folderInfo);
        this.childs = childs;
    }
    
    @Override
    public boolean isFolder() {
        return true;
    }

    @Override
    public String getName() {
         return folderInfo.getValue().getName();
    }

    @Override
    public String getLastChange() {
         return Utils.getChangeString(folderInfo.getChangeChangeLog());
        
    }

    @Override
    public String getSize() {
        return "-";
    }

    @Override
    public Long getId() {
        return folderInfo.getValue().getId();
    }

    @Override
    public Folder getValue() {
        return folderInfo.getValue();
    }

    @Override
    public String getOwner() {
        return folderInfo.getOwner().getUserName();
    }

    @Override
    public String getRigtsString() {
        return folderInfo.getRights().getType();
    }

    @Override
    public Rights getRigts() {
        return folderInfo.getRights();
    }

    @Override
    public boolean isShared() {
        return folderInfo.getType() == FolderTypeEnum.SHARED;
    }
    
}
